import React from 'react';
import { WeaAuth, WeaTab, WeaDialog, WeaLocaleProvider } from 'ecCom';
import { observer } from 'mobx-react';
import { shareCondition } from './condition';
import { WeaTableNew } from 'comsMobx';
import { Button } from 'antd';
const WeaTable = WeaTableNew.WeaTable;
const getLabel = WeaLocaleProvider.getLabel;

@observer
export default class NewTaskDialog extends React.Component {
    render() {
        const { store } = this.props;
        const { shareDialog, shareListVisible, shareListTableStore, shareDeleteDisabled } = store;
        return (
            <WeaDialog
                icon={"icon-coms02-Data-center"}
                iconBgcolor="#1a57a0"
                title={getLabel('505958','共享权限')}
                draggable={true}
                style={{ width: document.documentElement.clientWidth * 0.8, height: document.documentElement.clientHeight * 0.8 }}
                hasScroll={true}
                visible={shareListVisible}
                onCancel={store.hideShareList}
            >
                <WeaTab
                    // datas={[{ key: 'custom', title: '非默认共享' }]}
                    // keyParam="key"
                    // selectedKey={shareListType}
                    // onChange={store.changeShareListType}
                    buttons={[
                        (<Button type="primary" onClick={store.addShare} title={getLabel('505959','新增')}>{getLabel('505959','新增')}</Button>),
                        (<Button title={getLabel(502286,'删除')} onClick={store.deleteShare} disabled={shareDeleteDisabled}>{getLabel(502286,'删除')}</Button>),
                        (<Button title={getLabel('502292','刷新')} onClick={store.reloadTable}>{getLabel('502292','刷新')}</Button>)
                    ]}
                />
                <WeaTable comsWeaTableStore={shareListTableStore} register_table={store.reloadTable} needScroll={true} hasOrder={true} uniqueId={true} />
                <WeaAuth
                    icon={"icon-coms02-Data-center"}
                    iconBgcolor="#1a57a0"
                    style={{ height: 'auto' }}
                    conditions={shareCondition}
                    {...shareDialog}
                    modalClassName="edc-app-share-dialog"
                />
            </WeaDialog>
        )
    }
}